package com.dp.vo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Embeddable
public class NewsK16serverCityPK implements Serializable {
	    @Basic(optional = false)
	    @JoinColumn(name = "cityid", referencedColumnName = "areaid")   
		@ManyToOne
	    private TAreainfo city;
	    @Basic(optional = false)
	    @Column(name = "softagent")
	    private String softagent;
	    
	    public NewsK16serverCityPK(){
	    	
	    }
	    public NewsK16serverCityPK(Integer areaid,String softagent){
	    	this.city=new TAreainfo(areaid);
	    	this.softagent=softagent;
	    }
	    
		
		public TAreainfo getCity() {
			return city;
		}
		public void setCity(TAreainfo city) {
			this.city = city;
		}
		public String getSoftagent() {
			return softagent;
		}
		public void setSoftagent(String softagent) {
			this.softagent = softagent;
		}
		
		
		@Override
	    public int hashCode() {
	        int hash = 0;
	        hash += (city.getAreaid() != null ? city.getAreaid().hashCode() : 0);
	        hash += (softagent != null ? softagent.hashCode() : 0);
	        return hash;
	    }

	    @Override
	    public boolean equals(Object object) {
	        if (!(object instanceof NewsK16serverCityPK)) {
	            return false;
	        }
	        NewsK16serverCityPK other = (NewsK16serverCityPK) object;
	        if ((this.city.getAreaid() == null && other.city.getAreaid() != null) || (this.city.getAreaid() != null && !this.city.getAreaid().equals(other.city.getAreaid()))) {
	            return false;
	        }
	        if ((this.softagent == null && other.softagent != null) || (this.softagent != null && !this.softagent.equals(other.softagent))) {
	            return false;
	        }
	        return true;
	    }

	    @Override
	    public String toString() {
	        return "com.dp.vo.NewsK16serverCityPK[cityid=" + city.getAreaid() + ",softagent="+softagent+"]";
	    }
}
